import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;


public class Controlador implements ActionListener,WindowListener{


	private VentanaMenu menu;
			
	//OK Constructor copia del controlador para el menu
	public Controlador(VentanaMenu menu2) {
		this.menu= menu2;
	}
			
	//OK Gestion de Eventos
	public void actionPerformed(ActionEvent e) {
		
		if ("salir".equals(e.getActionCommand())) {
			menu=null;
			System.exit(0);					
			
		}else {
			if("absolute".equals(e.getActionCommand())){
				Absolute absolute;
				absolute=new Absolute();
				absolute.Vista();
				menu.escritorio.add(absolute);
				absolute.toFront();
				
			}else{				
				if("border".equals(e.getActionCommand())){
					Border border;
					border=new Border();
					border.Vista();
					menu.escritorio.add(border);
					border.toFront();
				}
			}
		}
	}
			
	//OK main
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		VentanaMenu menu= new VentanaMenu();
		Controlador controlador= new Controlador(menu);

		menu.setControlador(controlador);
		menu.VentanaMuestraMenu();		
	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosed(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowClosing(WindowEvent e) {
		// TODO Auto-generated method stub
		System.exit(0);
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void windowOpened(WindowEvent e) {
		// TODO Auto-generated method stub
		
	}

}
